package com.example.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.example.pojo.cgqg;
import com.example.service.CgpgBiz;
import com.example.vo.cgqgvo;

@RestController
@RequestMapping("/cgqg")
public class CgpgController {
	@Autowired
	private CgpgBiz biz;
	private String cgid;

	 
    @ResponseBody
    @RequestMapping("/save")
	public void addcgqg(@RequestBody cgqg cg){
    	/*System.out.println("2222"+cg);*/
    	/*System.out.println("cgcgcgcg    "+cg);*/
		biz.addcgpg(cg);
	}
	
    /**
     * 分页查询
     * @param pagenum
     * @return
     */
	@RequestMapping("/cgqgqueryById")
	@ResponseBody
	public cgqgvo queryById(@RequestParam("id") Integer pagenum){
		/*System.out.println("11111");*/
		/*System.out.println("222"+pagenum);*/
		cgqgvo c=biz.selectcgpg(pagenum);
		return c;
	}
	
	@RequestMapping("/delcgqgByid")
	public void delcgqg(String billno){
		
		biz.delcgqg(billno);
	}
	
	@RequestMapping(value="/selectCountBillno",method=RequestMethod.GET)
	@ResponseBody
	public Integer selectCountBillno(){
		return biz.selecCountBillno();
	}
	
	@RequestMapping("/selectQgshzt")
	public String selectQgshzt(@RequestParam("billno") String billno){
		/*System.out.println(billno);
		System.out.println("111111111111"+biz.selectQgshzt(billno));*/
		return biz.selectQgshzt(billno);
	}
	
	@RequestMapping("/updateshzt")
	public void updateqQGshenhe(@RequestParam("shzt") String shenhezhuangtai,@RequestParam("billno") String billno){
		biz.updateqQGshenhe(shenhezhuangtai, billno);
	}
	
	@RequestMapping("/queryAllcgqg")
	@ResponseBody
	public List<cgqg> queryAllcgqg(){
		System.out.println(biz.queryAllcgqg());
		return biz.queryAllcgqg();
	}
	
	@RequestMapping("/querycgqgById")
	@ResponseBody
	public cgqgvo querycgqgById(@RequestParam("bino") String billno){
		return biz.querycgqgById(billno);
	}
	
	@RequestMapping("/cgqg")
	public ModelAndView d(){ 
		return new ModelAndView("cgqg");
	}
	
/*	@RequestMapping("/cgqg")
	public ModelAndView xzwl(){ 
		return new ModelAndView("ttchoicewuliao");
	}*/
	
}
